<?php

use Illuminate\Support\Facades\Route;

//注册
Route::post('register', [\App\Http\Controllers\Admin\LoginController::class, 'register']);
//登录
Route::post('login', [\App\Http\Controllers\Chat\LoginController::class, 'chatLogin']);

//Route::group(['middleware' => ['chat.guards','auth:chat']], function () {// 用户信息
Route::group(['middleware' => ['auth:sanctum']], function () {
    // 登出
    Route::get('logout', [\App\Http\Controllers\Chat\LoginController::class, 'logout']);
    // 用户信息
    Route::any('/user/{id}', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'userInfo']);
    // 更改用户信息
    Route::post('/user/update/info', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'updateUserInfo']);
    // 好友列表
    Route::any('/user/my/friends', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'friends']);
    // 好友分组列表
    Route::post('/user/group/friend/lists', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'groupFriends']);
    // 更改好友分组名
    Route::post('/user/group/update/name', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'updateGroupName']);
    // 更改好友备注
    Route::post('/user/update/friend/remark', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'updateRemark']);
    // 搜索好友
    Route::post('/user/search/friend', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'searchFriend']);
    // 添加好友
    Route::post('/user/add/friend', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'addFriend']);
    // 好友请求列表
    Route::post('/user/friend/apply/list', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'friendApplyList']);
    // 待处理好友数量
    Route::post('/user/my/newFriendNum', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'newFriendNum']);
    // 获取添加人详情
    Route::post('/user/get/newFriend', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'getNewFriend']);
    // 同意好友申请
    Route::post('/user/friend/apply/agree', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'agreeNewFriend']);
    // uid绑定client_id
    Route::post('/user/bind/client_id', [\App\Http\Controllers\Chat\User\ChatUserController::class, 'bindClientId']);
    // 客户端发送消息
    Route::post('/user/send/msg',[\App\Http\Controllers\Chat\User\ChatUserController::class, 'sendMsg']);
    // 查看消息记录
    Route::post('/user/msg/history',[\App\Http\Controllers\Chat\User\ChatUserController::class, 'msgHistory']);
    // 用户断开连接
    Route::post('/user/connect/logout',[\App\Http\Controllers\Chat\User\ChatUserController::class, 'userLogout']);
    // 用户进入/离开房间
    Route::post('/user/comingOrLeave/group',[\App\Http\Controllers\Chat\User\ChatUserController::class, 'comingOrLeaveGroup']);
});

//千图成像接口
Route::group(['prefix' => 'image'], function () {
    Route::post('upload', [\App\Http\Controllers\ImageController::class, 'uploadImages']);
});

//公共接口
Route::group(['prefix' => 'global'], function () {
    //枚举
    Route::get('reference', [\App\Http\Controllers\GlobalController::class, 'reference']);
    //文件上传
    Route::post('upload', [\App\Http\Controllers\GlobalController::class,'upload']);
});
